Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

TAJO-939: Refactoring the column resolver in LogicalPlan#71

Closed
hyunsik wants to merge 16 commits into
apache:masterfrom
hyunsik:TAJO-939
Closed

TAJO-939: Refactoring the column resolver in LogicalPlan#71
hyunsik wants to merge 16 commits into
apache:masterfrom
hyunsik:TAJO-939

Conversation

@hyunsik
Copy link
Copy Markdown
Member

@hyunsik hyunsik commented Jul 14, 2014

See the description in TAJO-939 (https://issues.apache.org/jira/browse/TAJO-939).

I fixed the problem mentioned in the description. Also, I refactored the name resolver as follows:

  • I extracted the resolving part from LogicalPlan into made NameResolver, abstract class.
  • I made a sub class for each resolving level.
  • I extracted some common parts from the past resolving code and made into utility methods.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better use the above 'projectTargetExprs' variable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your suggestion. I'll do so.

@jihoonson
Copy link
Copy Markdown
Contributor

Hi Hyunsik, I have a question.
Do you have any rules for resolving names?
If so, please share it. It will help us reviewing your patch.
Thanks.

@hyunsik
Copy link
Copy Markdown
Member Author

hyunsik commented Jul 14, 2014

Thank you for the quick review.

Unfortunately, I couldn't find any rule in literatures and SQL standards. I expect that it is not specified in SQL standards because commercial DBMSs have different behaviors.

So, I analyzed the behavior of PostgreSQL, and then I made it.

@jihoonson
Copy link
Copy Markdown
Contributor

Thanks for your reply.
If you can, would you mind sharing your rule?
Actually, while reviewing, it is hard for me to check that resolve level is properly set.

@hyunsik
Copy link
Copy Markdown
Member Author

hyunsik commented Jul 14, 2014

Please see the following comments. I've just added the explanation about the motivation, all modes, and an example.
https://github.com/apache/tajo/pull/71/files#diff-4f557feed9e12061e60da8dc979e7a5bR23

I hope that it's helpful for your understanding.

@jihoonson
Copy link
Copy Markdown
Contributor

Thanks!
I'll review today.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In setRawTargets(), raw expressions are found instead of references. So, it seems that resolving level should be set as RELS_ONLY. If I misunderstand, please let me know. Thanks.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name references in select list can be only actual column names. They are addressed in the manner at https://github.com/apache/tajo/pull/71/files#diff-c11c2244fea624cb7b08f6906d554cd4R470.

In contrast, setRawTargets() in visitProjection should deal with actual fields as well as temporal fields generated by common subexpression elimination. So, it should use RELS_AND_SUBEXPRS.

@jihoonson
Copy link
Copy Markdown
Contributor

Hi Hyunsik. I left some questions.
Also, I have one more question.
Would you mind explaining why legacy level is used for join? Is RELS_AND_SUBEXPRS sufficient such as where clause?

hyunsik added 3 commits July 17, 2014 15:13
Conflicts:
	tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanPreprocessor.java
	tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanner.java
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you commented, fields in LIMIT are resolved in the REL_ONLY mode. Please fix it.

@hyunsik
Copy link
Copy Markdown
Member Author

hyunsik commented Jul 20, 2014

@jihoonson I really appreciate your detailed review. I rebased the branch against the latest revision, and I reflected your comment. Please help to review it again.

Thank you!

@hyunsik
Copy link
Copy Markdown
Member Author

hyunsik commented Jul 22, 2014

@jihoonson Join requires more complex conditions. So, I need to clean up the name resolving logic for join condition, and I need more time for this job. If you are Ok, I'll do it in another Jira.

@hyunsik
Copy link
Copy Markdown
Member Author

hyunsik commented Jul 22, 2014

Rebased.

@jihoonson
Copy link
Copy Markdown
Contributor

Thanks for your reply!
Currently, the latest patch looks good, and +1!

@jihoonson
Copy link
Copy Markdown
Contributor

And please create a Jira issue for name resolution of join condition.
Thanks!

@hyunsik
Copy link
Copy Markdown
Member Author

hyunsik commented Jul 22, 2014

Thank you very much. I'll create the jira.

@asfgit asfgit closed this in 862435b Jul 22, 2014
@hyunsik
Copy link
Copy Markdown
Member Author

hyunsik commented Jul 22, 2014

I've made the jira to clean up the name resolving logic for join condition.
https://issues.apache.org/jira/browse/TAJO-971

babokim pushed a commit to babokim/tajo that referenced this pull request Dec 11, 2014
ZEPPELIN-121 Fix handling escpae char in erb evaluator
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants